Skip to content

Conversation

MovGP0
Copy link

@MovGP0 MovGP0 commented Sep 9, 2025

This is a port of the material-color-utilities (MCU) to C#.

  • This code can be used for automatic MaterialDesign3 color scheme generation from a selected color.
  • Unit tests are ported from the dart version of the library
  • See m3.material.io: Color system for details
  • Implemented Shims to work with net462 and net8.0-windows targets

@MovGP0
Copy link
Author

MovGP0 commented Sep 10, 2025

The library creates colors according to this system:
image

@Keboo Keboo self-requested a review September 15, 2025 05:16
@Keboo
Copy link
Member

Keboo commented Sep 15, 2025

Wow @MovGP0 this looks really cool. It will take me some time to get it reviewed. But thank you for it.

@MovGP0
Copy link
Author

MovGP0 commented Sep 21, 2025

@Keboo I was trying to keep the implementation as close as possible to the original implementation.

However, this has also has some drawback we should consider:

  1. colors are represented as signed 32bit integers, instead of System.Windows.Color. While a conversion is easily possible, the question is if we only should use a conversion at the border of the library, or also replace int with Color for internal usage and break with the original source.
  2. the unit tests don't have a 100% coverage and have multiple asserts per test. While this makes it aligned wtih the original source code, I'd consider it bad practice to structure unit tests like this.
  3. the CS0618 warning is on purpose, since this is how it's in the original code. The question is if this code should be removed or the warning suppressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants